<?php

define ("ALL", -1);
define ("DEBUG", 0);
define ("INFO", 1);
define ("WARN", 2);
define ("ERROR", 3);
define ("FATAL", 4);
		
class logger {
	
	var $_level;   /* niveau de log a afficher */
	var $_file;	   /* fichier de log */
	
	function logger ($level, $stringfile) {
		$this->_level = $level;
		$this->_file = $stringfile;
	}
	
	function log ($niveau, $message) {
		$fp = fopen ($this->_file, "a");  
		if ($niveau >= $this->_level) {
			$date = date("d/m/Y, H:i:s");
			fwrite($fp, $date."  ");
			fwrite($fp,$message."\n");
		}
		fclose ($fp); 
	}
}
?>